<div class="main-content">
    <div class="left-panel"></div>
    <div class="panel">
        <?php echo $this->element("backend/left_menu");?>
        <div class="content">
            <div class="title">
                <h2 class="t1">Category Management</h2>
            </div>
            <?php echo $this->session->flash(); ?>
            <form action="" id="table-list-admin-form">
                <div class="top_action">
                    <br />
                    <input type="text" value="" class="searh_input" placeholder="  Search key" />
                    <a class="btnsearch">
                        <span>Search</span>
                    </a>

                    <a href="<?php echo $this->Html->url("/categories/admin_add");?>" class="add">
                        <span>Add</span>
                    </a>

                </div>
                <br />
                <table cellspacing="0" cellpadding="0" class="display" id="table-list-admin">
                    <thead>
                        <tr class="header">
                            <th class="order" width="5%">
                                <a href="#">#</a>
                            </th>
                            <th class="left">
                                <a href="">Id</a>
                            </th>
                            <th>
                                <a href="">Category Name</a>
                            </th>

                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i=1; foreach ($categories as $k=>$category ) {?>
                        <tr>
                            <td>
                                <?php echo $i++; ?>
                            </td>
                            <td><?php echo h($category['Category']['id']); ?>&nbsp;</td>
							<td><?php echo h($category['Category']['category_name']); ?>&nbsp;</td>
                            <td class="action" nowrap>
                                <a class="edit" title="Edit" href="<?php echo $this->Html->url("/categories/admin_edit/".$category['Category']['id']); ?>">Edit</a>
                                <a class="delete" href="<?php echo $this->Html->url("/categories/admin_delete/".$category['Category']['id']); ?>" title="Delete" onclick="return confirm('Are you sure you want to delete category id: <?php echo $category['Category']['id'] ?> ');">Delete</a>
                            </td>
                        </tr>
                        <?php } ?>

                    </tbody>
                </table>
            </form>
            <br />
            <div>
                <?php echo $this->Paginator->prev('',array('tag'=>'a','class' => 'page-far-left','id'=>'prev'),'', array('tag'=>'a','class' => 'page-far-left','id'=>'prev')); ?>
                <div id="page-info">Page
                    <strong>
                        <?php echo $this->request->params['paging']['Category']['page'] ?>
                    </strong>/
                    <?php echo $this->request->params['paging']['Category']['pageCount'] ?>
                </div>
                <?php echo $this->Paginator->next("",array('tag'=>'a','class' => 'page-far-right','id'=>'next'), null, array('tag'=>'a','class' => 'page-far-right','id'=>'next')); ?>

            </div>

        </div>
    </div>
    <div class="right-panel"></div>
    <!-- main.end -->
</div>
<script>
$(".page-far-left").click(function() {

    window.location.href = document.getElementById('prev').href;
});
$(".page-far-right").click(function() {

    window.location.href = document.getElementById('next').href;
});
</script>